<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>layout 后台大布局 - Layui</title>
  <link rel="stylesheet" href="/layui/css/layui.css">
  <link rel="stylesheet" href="/layui/pinfen.css">
  <style>
    a {font-size:22px;}

    a:link {color: blue; text-decoration:none;}

    a:active {color: red; }

    a:visited {color:purple;text-decoration:none;}

    a:hover {color: red; text-decoration:underline;}
    .layui-body{

    }
    .layui-layout-admin .layui-body{
      left:15px;
      top:15px;
    }
  </style>


</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
  <div class="layui-body">
      {{content}}
  </div>
</div>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/layui/js/jquery.min.js"></script>
<script type="text/javascript" src="/layui/jquery.cityselect.js"></script>
<script type="text/javascript" src="/layui/field.js"></script>
<script type="text/javascript" src="/layui/comment.js"></script>

<script>
    layui.use(['form', 'layedit', 'laydate'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate;

        //日期
        laydate.render({
            elem: '#date'
        });
        laydate.render({
            elem: '#date1'
        });

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');



        //监听指定开关
        form.on('switch(switchTest)', function(data){
            layer.msg('开关checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '6px'
            });
            layer.tips('温馨提示：请注意开关状态的文字可以随意定义，而不仅仅是ON|OFF', data.othis)
        });

        //监听提交
        form.on('submit(demo1)', function(data){
            console.log(data);
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });



    });
</script>